import 'dart:convert';

import 'package:star_author/data/json_common_func.dart';

class ResponseBodyMetaData {
  ResponseBodyMetaData({
    required this.totalPages,
    required this.currentPage,
    required this.totalCount,
  });

  factory ResponseBodyMetaData.fromJson(Map<String, dynamic> json) =>
      ResponseBodyMetaData(
        totalPages: asT<int>(json['total_pages'])!,
        currentPage: asT<int>(json['current_page'])!,
        totalCount: asT<int>(json['total_count'])!,
      );

  int totalPages;
  int currentPage;
  int totalCount;

  @override
  String toString() {
    return jsonEncode(this);
  }

  Map<String, dynamic> toJson() => <String, dynamic>{
        'total_pages': totalPages,
        'current_page': currentPage,
        'total_count': totalCount,
      };
}
